package com.cellulam.framework.mq;

import com.aliyun.openservices.ons.api.PropertyKeyConst;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Properties;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RocketMqConfig {
    private String groupId;
    private String nameSrv;
    private String accessKey;
    private String secretKey;

    /**
     * 发送超时
     */
    private Integer sendTimeoutMillis;

    public Properties toMqProperties() {
        Properties properties = new Properties();
        properties.put(PropertyKeyConst.GROUP_ID, this.groupId);
        properties.put(PropertyKeyConst.AccessKey, this.accessKey);
        properties.put(PropertyKeyConst.SecretKey, this.secretKey);
        properties.put(PropertyKeyConst.NAMESRV_ADDR, this.nameSrv);

        properties.put(PropertyKeyConst.ENABLE_ORDERLY_CONSUME_ACCELERATOR , true);
        return properties;
    }
}
